package com.hrserviceserve.dao;

import com.hrserviceserve.entity.Personnel;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

public interface PersonnelRepository extends JpaRepository<Personnel,Integer> {
    int deleteByPersonnelId(int id);

    Personnel findByPersonnelId(int id);
    @Query(value = "select * from personnel where if(?1!='',department=?1,1=1) and if(?2!='',sex=?2,1=1) and if(?3!='',personnel_name=?3,1=1)",nativeQuery = true)
    Page<Personnel> findAllWhere(String department, String sex, String name, Pageable pageable);

}
